package io;

import java.util.Timer;
import java.util.TimerTask;

import cpu.CPU;

public class IODevice {
	/**
	 * The timer used for scheduling the interrupt.
	 */
	private Timer my_timer;

	/**
	 * Creates a new IODevice. This has a timer that causes an interrupt to UI.
	 */
	public IODevice() {
		my_timer = new Timer();
	}

	/**
	 * Creates a timed task ran by the timer.
	 * 
	 * @author kyle
	 * @version 3.9.13
	 * 
	 */
	private class InterruptTask extends TimerTask {

		@Override
		public void run() {
			CPU.ui_interrupt = true;
		}

	}

	public void setTimer() {
		my_timer.schedule(new InterruptTask(), 2000, 2000);
	}
}
